package api

import (
	"github.com/gogf/gf/frame/g"
	"github.com/gogf/gf/net/ghttp"
)


func Show(r *ghttp.Request) {
	tag :=  r.Get("tag")
	article := r.Get("article")
	art, err := g.Model("blog_article").Fields("id","title", "content").Where("id=? and tag_id=?", article, tag).One()
	if err != nil {
		r.Response.Writeln(err)
		return
	}
	if len(art) == 0 {
		r.Response.Writeln("指定文章不存在")
		return
	}
	err = r.Response.WriteTpl("detail.html", g.Map{
		"tid":   tag,  // 当前栏目名
		"md":    art["content"],  // 文章内容
		"title": art["title"].String(),  // 文章标题
		"aid":   article,  // 当前文章编号
	})
	if err != nil {
		r.Response.Writeln(err)
		return
	}
}
